<?php
global $_GPC, $_W;
$uniacid = $_W['uniacid'];
$id = $_GPC['id'];
$res = $this->res;
$plus = $this->plus;
load()->func('tpl');
$setting = $this->baseset($uniacid);
$settings = $this->module['config'];
$openid = $_W['openid'];
$userinfo = $this->Get_checkoauth();
if (empty($_W['openid'])) {
	$openid = $userinfo['openid'];
}
$follow = $userinfo['follow'];
$user = $this->getuserinfo($openid, $userinfo['nickname'], $userinfo['avatar'], $follow);
$allcate = pdo_fetchall("SELECT * FROM " . tablename($this->tablecate) . " WHERE uniacid = '{$_W['uniacid']} ' AND status=1");
$allcateall = pdo_fetchall("SELECT * FROM " . tablename($this->tablecateall) . " WHERE uniacid = '{$_W['uniacid']} ' AND status=1 order by displayorder desc");
$allcatedtk = pdo_fetchall("SELECT * FROM " . tablename($this->tablecatedtk) . " WHERE uniacid = '{$_W['uniacid']} ' AND status=1 order by displayorder desc");
$indexcate = pdo_fetchall("SELECT * FROM " . tablename($this->tablecate) . " WHERE uniacid = '{$_W['uniacid']} ' AND pic!=''");
$vuser = pdo_fetch("SELECT * FROM " . tablename($this->tableuser) . " WHERE uniacid = :uniacid AND id=:id", array(':uniacid' => $_W['uniacid'], ':id' => $id,));
$myuc = pdo_fetch("SELECT * FROM " . tablename($this->tableuser) . " WHERE uniacid = :uniacid AND openid=:openid", array(':uniacid' => $_W['uniacid'], ':openid' => $openid,));
if (!empty($vuser)) {
	$myvid = $vuser['id'];
	$myopenid = $vuser['openid'];
	$yid = $vuser['id'];
} else {
	$myvid = $myuc['id'];
	$myopenid = $myuc['openid'];
	$yid = $myuc['id'];
}
if (empty($myvid)) {
	message('参数错误！', $this->createMobileUrl('index'), 'error');
}
if ($userinfo['openid'] != $myopenid) {
	message('无权限访问其他用户信息！', $this->createMobileUrl('index'), 'error');
}
if (empty($myuc['url'])) {
	$nohb = 1;
}
if ($user['avatar']) {
	$user['avatar'] = $this->getpic($user['avatar']);
}
$_share['title'] = "来自" . $userinfo['nickname'] . "的推荐：" . $setting['fxtit'];
$_share['imgUrl'] = tomedia($userinfo['avatar']);
$_share['desc'] = $setting['fxdes'];
$_share['link'] = $_W['siteroot'] . "app/index.php?i=" . $_W['uniacid'] . "&c=entry&do=yaoqing&m=bsht_tbk&yid=" . $vuser['id'];
$_W['page']['sitename'] = $setting['sitetitle'];
$pagename = '邀请好友';
include $this->template('haibao');